$(document).ready(function() { $("a[href*='#']").click(function(e) { console.log("click") $("body").removeClass("menu-opened") $([document.documentElement, document.body]).animate({ scrollTop: $($(this).attr("href")).offset().top }, 800); }); if (localStorage.getItem("lotteryRotated")) { $(".success-part").show(); $(".lottery-box-wrapper").hide(); start_timer() // $("a[href='#promo']").attr("href", "#order") } $(".lottery-btn").click(function() { var $that = $(this); var $lotteryRound = $that.closest(".lottery-box-wrapper").find(".lottery-round"); $lotteryRound.css("animation", "rotate 5s forwards"); $lotteryRound.css("animation-timing-function", "cubic-bezier(.46,.07,.19,1.06)"); setTimeout(function() { $that.closest(".lottery-box-wrapper").find(".lottery-round").addClass("rotated"); localStorage.setItem("lotteryRotated", true); // $that.find(".text-init").hide(); // $that.find(".text-sale-count").show(200); $(".success-part").fadeIn(); $(".lottery-box-wrapper").fadeOut(); $(".result-popup-wrap").addClass("active"); start_timer(); $([document.documentElement, document.body]).animate({ scrollTop: $("#success").offset().top }, 1200); }, 5000); }); $(".result-popup-wrap").click(function () { $(this).fadeOut(500); }) }) function handleReviewScroll() { const offset = $(window).height() / 3; const $holder = $(".reviews"); $(".review").eq(0).hide() if (getDocumentScrollTop() + $(window).height() >= $holder.offset().top) { setTimeout(function() { $(".review").eq(0).fadeIn(320); }, 640) window.removeEventListener('scroll', handleReviewScroll); } } function getDocumentScrollTop() { return $(document.scrollingElement || document.documentElement).scrollTop(); } function endDifDate(countDays) { if (countDays || countDays === 0) { countDays = parseInt(countDays); const date = new Date(Date.now() - (86400000 * countDays)); return pad(date.getDate()) + "." + pad(date.getMonth() + 1) + "." + date.getFullYear(); } } function pad(num) { return ("0" + num).substr(-2); } function quantityProduct (max, min, diff, delayMs) { if (localStorage.getItem("count-prod")) { max = localStorage.getItem("count-prod"); } else { localStorage.setItem("count-prod", max); } $(".js-quantity-product").text(max); setInterval(function() { max = localStorage.getItem("count-prod"); if (max > min) { localStorage.setItem("count-prod", (max - diff)); max = localStorage.getItem("count-prod"); $(".js-quantity-product").html(max) } // else { // localStorage.setItem("count-prod", maxProdInit); // max = localStorage.getItem("count-prod"); // // $(".js-quantity-product").html(max); // } }, delayMs) } var maxProdInit = 19; jQuery(document).ready(function($) { $(".currency-year").text(new Date().getFullYear()); quantityProduct(maxProdInit, 1,1, 90000); handleReviewScroll(); window.addEventListener('scroll', handleReviewScroll); var $path = $("body").data("path") $(".form-reviews button").click(function (event) { var commentName = $(this).closest(".form-reviews").find('input').val(); var commentText = $(this).closest(".form-reviews").find('textarea').val(); var commentNamePlaseholder = $(this).closest(".form-reviews").find('.form-comment--name input').attr("placeholder"); if ($(this).closest(".form-reviews").find('textarea').val().length > 0) { if (commentName === "") { commentName = commentNamePlaseholder; } var el = "